<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        div{
            width: 100px;
            height: 100px;
            background-color: yellowgreen;
        }
    </style>
    <script>

        window.onload = function(){
            const divObj = document.querySelector("div")
            /* 
                event：表示的就是事件本身
                    获取事件的二种方式
                        1.通过传参
                        2.通过window.event
             */
            divObj.onclick = function(event){       //参数随便给
                //方式一
                console.log(event)
                console.log(event.type)     //click
                //方式二
                console.log(window.event)       //这个必须要event，不能任给参数
            }
        }
    </script>
</head>
<body>
    <div>
        事件对象
    </div>
</body>
</html>